package com.foreknow.oop;

public class ConstrctorDemo {
    private String name;
    private int age;

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public ConstrctorDemo(String name,int age){
        this.name = name;
        this.age = age;
        System.out.println("这是一个构造器...");
    }

    public static void main(String[] args) {
        ConstrctorDemo constrctorDemo = new ConstrctorDemo("fender",23);
        System.out.println(constrctorDemo.getName()+" "+constrctorDemo.getAge());
    }
}

